<?php

namespace backend\models\odm;

use Yii;

/**
 * This is the model class for table "xs_admin".
 *
 * @property string $id
 * @property string $admin_sn
 * @property string $username
 * @property string $auth_key
 * @property string $password_hash
 * @property string $email
 * @property integer $role
 * @property integer $status
 * @property integer $type
 * @property integer $pid
 * @property string $remark
 * @property string $cost
 * @property string $create_time
 * @property string $update_time
 */
class AdminOdm extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'xs_admin';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['role', 'status', 'type', 'pid'], 'integer'],
            [['type'], 'required'],
            [['cost'], 'number'],
            [['create_time', 'update_time'], 'safe'],
            [['admin_sn', 'email', 'remark'], 'string', 'max' => 255],
            [['username'], 'string', 'max' => 60],
            [['auth_key'], 'string', 'max' => 32],
            [['password_hash'], 'string', 'max' => 64],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => Yii::t('app', '自增ID'),
            'admin_sn' => Yii::t('app', '合作账号'),
            'username' => Yii::t('app', '管理员/合作方/渠道名称'),
            'auth_key' => Yii::t('app', '自动登录key'),
            'password_hash' => Yii::t('app', '加密密码'),
            'email' => Yii::t('app', '邮箱'),
            'role' => Yii::t('app', '角色等级'),
            'status' => Yii::t('app', '状态'),
            'type' => Yii::t('app', '账号类型1超级管理员 2合作账号 3渠道'),
            'pid' => Yii::t('app', '父级id'),
            'remark' => Yii::t('app', '备注'),
            'cost' => Yii::t('app', '成本'),
            'create_time' => Yii::t('app', '浏览时间'),
            'update_time' => Yii::t('app', '修改时间'),
        ];
    }
}
